
QL_TESTS = \
	quantlibtestsuite.cpp \
	speedlevel.hpp \
	americanoption.hpp americanoption.cpp \
	amortizingbond.hpp amortizingbond.cpp \
	andreasenhugevolatilityinterpl.hpp andreasenhugevolatilityinterpl.cpp \
	array.hpp array.cpp \
	asianoptions.hpp asianoptions.cpp \
	assetswap.hpp assetswap.cpp \
	autocovariances.hpp autocovariances.cpp \
	barrieroption.hpp barrieroption.cpp \
	binaryoption.hpp binaryoption.cpp \
	basismodels.hpp basismodels.cpp \
	basketoption.hpp basketoption.cpp \
	batesmodel.hpp batesmodel.cpp \
	bermudanswaption.hpp bermudanswaption.cpp \
	blackdeltacalculator.hpp blackdeltacalculator.cpp \
	blackformula.hpp blackformula.cpp \
	bonds.hpp bonds.cpp \
	brownianbridge.hpp brownianbridge.cpp \
	businessdayconventions.hpp businessdayconventions.cpp \
	calendars.hpp calendars.cpp \
	capfloor.hpp capfloor.cpp \
	capflooredcoupon.hpp capflooredcoupon.cpp \
	cashflows.hpp cashflows.cpp \
	catbonds.hpp catbonds.cpp \
	cdo.hpp cdo.cpp \
	cdsoption.hpp cdsoption.cpp \
	chooseroption.hpp chooseroption.cpp \
	cliquetoption.hpp cliquetoption.cpp \
	cms.hpp cms.cpp \
	cmsspread.hpp cmsspread.cpp \
	commodityunitofmeasure.hpp commodityunitofmeasure.cpp \
	compiledboostversion.hpp compiledboostversion.cpp \
	compoundoption.hpp compoundoption.cpp \
	convertiblebonds.hpp convertiblebonds.cpp \
	covariance.hpp covariance.cpp \
	creditdefaultswap.hpp creditdefaultswap.cpp \
	creditriskplus.hpp creditriskplus.cpp \
	curvestates.hpp curvestates.cpp \
	dates.hpp dates.cpp \
	daycounters.hpp daycounters.cpp \
	defaultprobabilitycurves.hpp defaultprobabilitycurves.cpp \
	digitalcoupon.hpp digitalcoupon.cpp \
	digitaloption.hpp digitaloption.cpp \
	distributions.hpp distributions.cpp \
	dividendoption.hpp dividendoption.cpp \
	doublebarrieroption.hpp doublebarrieroption.cpp \
	doublebinaryoption.hpp doublebinaryoption.cpp \
	europeanoption.hpp europeanoption.cpp \
	everestoption.hpp everestoption.cpp \
	exchangerate.hpp exchangerate.cpp \
	extendedtrees.hpp extendedtrees.cpp \
	extensibleoptions.hpp extensibleoptions.cpp \
	fastfouriertransform.hpp fastfouriertransform.cpp \
	fdheston.hpp fdheston.cpp \
	fdmlinearop.hpp fdmlinearop.cpp \
	fdcev.hpp fdcev.cpp \
	fdsabr.hpp fdsabr.cpp \
	fittedbonddiscountcurve.hpp fittedbonddiscountcurve.cpp \
	forwardoption.hpp forwardoption.cpp \
	forwardrateagreement.hpp forwardrateagreement.cpp \
	functions.hpp functions.cpp \
	garch.hpp garch.cpp \
	gaussianquadratures.hpp gaussianquadratures.cpp \
	gjrgarchmodel.hpp gjrgarchmodel.cpp \
	gsr.hpp gsr.cpp \
	hestonmodel.hpp hestonmodel.cpp \
	hestonslvmodel.hpp hestonslvmodel.cpp \
	himalayaoption.hpp himalayaoption.cpp \
	hybridhestonhullwhiteprocess.hpp hybridhestonhullwhiteprocess.cpp \
	inflation.hpp inflation.cpp \
	inflationcapfloor.hpp inflationcapfloor.cpp \
	inflationcapflooredcoupon.hpp inflationcapflooredcoupon.cpp \
    inflationcpibond.hpp inflationcpibond.cpp \
    inflationcpicapfloor.hpp inflationcpicapfloor.cpp \
	inflationcpiswap.hpp inflationcpiswap.cpp \
	inflationvolatility.hpp inflationvolatility.cpp \
	instruments.hpp instruments.cpp \
	integrals.hpp integrals.cpp \
	interestrates.hpp interestrates.cpp \
	interpolations.hpp interpolations.cpp \
	jumpdiffusion.hpp jumpdiffusion.cpp \
	lazyobject.hpp lazyobject.cpp \
	libormarketmodel.hpp libormarketmodel.cpp \
	libormarketmodelprocess.hpp libormarketmodelprocess.cpp \
	linearleastsquaresregression.hpp linearleastsquaresregression.cpp \
	lookbackoptions.hpp lookbackoptions.cpp \
	lowdiscrepancysequences.hpp lowdiscrepancysequences.cpp \
	margrabeoption.hpp margrabeoption.cpp \
	marketmodel.hpp marketmodel.cpp \
	marketmodel_cms.hpp marketmodel_cms.cpp \
	marketmodel_smm.hpp marketmodel_smm.cpp \
	marketmodel_smmcapletalphacalibration.hpp marketmodel_smmcapletalphacalibration.cpp \
	marketmodel_smmcapletcalibration.hpp marketmodel_smmcapletcalibration.cpp \
	marketmodel_smmcaplethomocalibration.hpp marketmodel_smmcaplethomocalibration.cpp \
	markovfunctional.hpp markovfunctional.cpp \
	matrices.hpp matrices.cpp \
	mclongstaffschwartzengine.hpp mclongstaffschwartzengine.cpp \
	mersennetwister.hpp mersennetwister.cpp \
	money.hpp money.cpp \
	noarbsabr.hpp noarbsabr.cpp \
	normalclvmodel.hpp normalclvmodel.cpp \
	nthorderderivativeop.hpp nthorderderivativeop.cpp \
	nthtodefault.hpp nthtodefault.cpp \
	numericaldifferentiation.hpp numericaldifferentiation.cpp \
	observable.hpp observable.cpp \
	ode.hpp ode.cpp \
	operators.hpp operators.cpp \
	optimizers.hpp optimizers.cpp \
	optionletstripper.hpp optionletstripper.cpp \
	overnightindexedswap.hpp overnightindexedswap.cpp \
	pagodaoption.hpp pagodaoption.cpp \
	partialtimebarrieroption.hpp partialtimebarrieroption.cpp \
	pathgenerator.hpp pathgenerator.cpp \
	period.hpp period.cpp \
	piecewiseyieldcurve.hpp piecewiseyieldcurve.cpp \
	piecewisezerospreadedtermstructure.hpp piecewisezerospreadedtermstructure.cpp \
	quantooption.hpp quantooption.cpp \
	quotes.hpp quotes.cpp \
	rangeaccrual.hpp rangeaccrual.cpp \
	riskneutraldensitycalculator.hpp riskneutraldensitycalculator.cpp \
	riskstats.hpp riskstats.cpp \
	rngtraits.hpp rngtraits.cpp \
	rounding.hpp rounding.cpp \
	sampledcurve.hpp sampledcurve.cpp \
	schedule.hpp schedule.cpp \
	shortratemodels.hpp shortratemodels.cpp \
	sofrfutures.hpp sofrfutures.cpp \
	solvers.hpp solvers.cpp \
	spreadoption.hpp spreadoption.cpp \
	squarerootclvmodel.hpp squarerootclvmodel.cpp \
	stats.hpp stats.cpp \
	swap.hpp swap.cpp \
	swapforwardmappings.hpp swapforwardmappings.cpp \
	swaption.hpp swaption.cpp \
	swaptionvolatilitycube.hpp swaptionvolatilitycube.cpp \
	swaptionvolatilitymatrix.hpp swaptionvolatilitymatrix.cpp \
	swaptionvolstructuresutilities.hpp \
	swingoption.hpp swingoption.cpp \
	termstructures.hpp termstructures.cpp \
	timegrid.hpp timegrid.cpp \
	timeseries.hpp timeseries.cpp \
	transformedgrid.hpp transformedgrid.cpp \
	tqreigendecomposition.hpp tqreigendecomposition.cpp \
	tracing.hpp tracing.cpp \
	twoassetbarrieroption.hpp twoassetbarrieroption.cpp \
	twoassetcorrelationoption.hpp twoassetcorrelationoption.cpp \
	utilities.hpp utilities.cpp \
	variancegamma.hpp variancegamma.cpp \
	varianceoption.hpp varianceoption.cpp \
	varianceswaps.hpp varianceswaps.cpp \
	volatilitymodels.hpp volatilitymodels.cpp \
	vpp.hpp vpp.cpp \
	zabr.hpp zabr.cpp

QL_BENCHMARKS = \
	quantlibbenchmark.cpp \
	americanoption.hpp americanoption.cpp \
	asianoptions.hpp asianoptions.cpp \
	barrieroption.hpp barrieroption.cpp \
	doublebarrieroption.hpp doublebarrieroption.cpp \
	basketoption.hpp basketoption.cpp \
	batesmodel.hpp batesmodel.cpp \
	convertiblebonds.hpp convertiblebonds.cpp \
	digitaloption.hpp digitaloption.cpp \
	dividendoption.hpp dividendoption.cpp \
	europeanoption.hpp europeanoption.cpp \
	fdheston.hpp fdheston.cpp \
	hestonmodel.hpp hestonmodel.cpp \
	interpolations.hpp interpolations.cpp \
	jumpdiffusion.hpp jumpdiffusion.cpp \
	lowdiscrepancysequences.hpp lowdiscrepancysequences.cpp \
	marketmodel_cms.hpp marketmodel_cms.cpp \
	marketmodel_smm.hpp marketmodel_smm.cpp \
	quantooption.hpp quantooption.cpp \
	riskstats.hpp riskstats.cpp \
	shortratemodels.hpp shortratemodels.cpp \
	utilities.hpp utilities.cpp

dist-hook:
	mkdir -p $(distdir)/build
	mkdir -p $(distdir)/bin
	cp -p $(srcdir)/bin/runtest.bat $(distdir)/bin

if BOOST_UNIT_TEST_FOUND

AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir}

noinst_LTLIBRARIES = libUnitMain.la
libUnitMain_la_SOURCES = main.cpp
libUnitMain_la_CXXFLAGS = ${BOOST_UNIT_TEST_MAIN_CXXFLAGS}

if AUTO_BENCHMARK
bin_PROGRAMS = quantlib-test-suite quantlib-benchmark
else
bin_PROGRAMS = quantlib-test-suite
noinst_PROGRAMS = quantlib-benchmark
endif

if UNITY_BUILD

nodist_quantlib_test_suite_SOURCES = unity_test.cpp

unity_test.cpp: Makefile.am
	echo "/* This file is automatically generated; do not edit.     */" > $@
	echo "/* Add the files to be included into Makefile.am instead. */" >> $@
	echo >> $@
	for i in $(filter %.cpp, $(QL_TESTS)); do \
		echo "#include \"test-suite/$$i\"" >> $@; \
	done

nodist_quantlib_benchmark_SOURCES = unity_benchmark.cpp

unity_benchmark.cpp: Makefile.am
	echo "/* This file is automatically generated; do not edit.     */" > $@
	echo "/* Add the files to be included into Makefile.am instead. */" >> $@
	echo >> $@
	for i in $(filter %.cpp, $(QL_BENCHMARKS)); do \
		echo "#include \"test-suite/$$i\"" >> $@; \
	done

EXTRA_DIST = $(QL_TESTS) $(QL_BENCHMARKS)

else

quantlib_test_suite_SOURCES = $(QL_TESTS)

quantlib_benchmark_SOURCES = $(QL_BENCHMARKS)

EXTRA_DIST =

endif

quantlib_test_suite_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la \
                            ${BOOST_UNIT_TEST_LIB} ${BOOST_THREAD_LIB} ${BOOST_INTERPROCESS_LIB}

quantlib_benchmark_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la \
                           ${BOOST_UNIT_TEST_LIB} ${BOOST_THREAD_LIB}

TESTS = quantlib-test-suite$(EXEEXT)
TESTS_ENVIRONMENT = BOOST_TEST_LOG_LEVEL=message BOOST_TEST_COLOR_OUTPUT=false

.PHONY: benchmark
benchmark: quantlib-benchmark$(EXEEXT)
	BOOST_TEST_LOG_LEVEL=message ./quantlib-benchmark$(EXEEXT)

EXTRA_DIST += \
	CMakeLists.txt \
	paralleltestrunner.hpp \
	README.txt \
	testsuite.vcxproj \
	testsuite.vcxproj.filters

else

EXTRA_DIST = \
	${QL_TESTS} \
	CMakeLists.txt \
	paralleltestrunner.hpp \
	quantlibbenchmark.cpp \
	README.txt \
	testsuite.vcxproj \
	testsuite.vcxproj.filters

endif
